<template>
  <div>

  </div>
</template>

<script>
export default {
  components:{

  },
  data(){
    return{
      testMd:'sdsd',
      test:''
    }
  },
  mounted(){
    var md = require('markdown-it')();
    console.log(md);
    md.use(require('markdown-it-container'), 'code', {
    
      validate: function(params) {
        return params.trim().match(/^code\s+(.*)$/);
      },
    
      render: function (tokens, idx) {
        console.log(tokens,idx);
        // console.log(tokens[2]);
        var m = tokens[idx].info.trim().match(/^code\s+(.*)$/);
        var com = tokens[2].children[0].content
        console.log('com',md.render(com));
        if (tokens[idx].nesting === 1) {
          // opening tag
          if(md.utils.escapeHtml(m[1])){
            return '<details><summary>' + md.utils.escapeHtml(m[1]) + '</summary>\n';
          }
        } else {
          // closing tag
          return '</details>\n';
        }
      }
    });
    console.log(md.render('::: code s\n```<div>sdds<div>dssd</div></div>```\n:::\n'));
  }
}
</script>


<style>

</style>